# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Sherlock Holo <sherlockya@gmail.com>
# Contributor: user6553591 <Message on Reddit>

pkgname=python-websockets
pkgver=10.4
pkgrel=3
pkgdesc='Python implementation of the WebSocket Protocol (RFC 6455)'
url='https://github.com/aaugustin/websockets'
arch=('loong64' 'x86_64')
license=('BSD')
depends=('python')
makedepends=('python-setuptools' 'python-sphinx' 'python-sphinx-copybutton'
             'python-sphinx-furo' 'python-sphinx-inline-tabs'
             'python-sphinxcontrib-spelling' 'python-sphinxcontrib-trio'
             'python-sphinxext-opengraph')
source=(https://github.com/aaugustin/websockets/archive/${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('087b1920ff26e21b8d3b80b53249d44b841fc45a4992df1ad725112404f724a41aaa2d759a2bd521dfe337459f8bf0d2ae048c423489f527c68f6825f928b582')
b2sums=('f3a739368ff9d78fef79324af59d1e77b3fb654b8b1a847373a29f19b11ae9266b9a938d235ee27d12b59d9b4cf29825fc7298ff2f35e5b260df2c7a41a1bd78')

build() {
  cd websockets-${pkgver}
  python setup.py build
  sphinx-build -b dirhtml docs docs/_build/html
  sphinx-build -b man docs docs/_build/man
}

check() {
  cd websockets-${pkgver}
  python setup.py test
}

package() {
  cd websockets-${pkgver}
  python setup.py install --root="${pkgdir}" --optimize=1 --skip-build
  install -Dm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
  cp -rT docs/_build/html "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 docs/_build/man/websockets.1 "${pkgdir}/usr/share/man/man1/${pkgname}.1"
}

# vim: ts=2 sw=2 et:
